<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>

<script type="text/javascript">
		/**
		当initialValue参数不存在
		**/
		// let arr = [0,1,2,3];
		// let arrresult = arr.reduce((accumulator,currentValue,currentIndex)=>{
		// 	console.log(`累加器:${accumulator}`,`当前处理的元素:${currentValue}`,`当前索引:${currentIndex}`)
		// 	return accumulator+currentValue
		// })
		// console.log(arrresult)
		
		
		/**
		当initialValue参数存在
		**/
		let arr = [0, 1, 2, 3];
		let arrresult = arr.reduce((accumulator, currentValue, currentIndex) => {
			console.log(`累加器:${accumulator}`, `当前处理的元素:${currentValue}`, `当前索引:${currentIndex}`)
			return accumulator + currentValue
		},7)
		console.log(arrresult)
		
		
</script>
</body>
</html>
